export default {
    state: {
        uploads: {}
    },
    mutations: {
		SET_PROGRESS(state, { localId, index, percentage }) {
		  if (!state.uploads[localId]) {
		    Vue.set(state.uploads, localId, {});
		  }
		  Vue.set(state.uploads[localId], index, percentage);
		},
		DELETE_UPLOAD_GROUP(state, localId) {
		  delete state.uploads[localId];
		}
    },
	actions:{
		setProgress({ commit }, payload) {
		  commit('SET_PROGRESS', payload);
		},
		deleteUploadGroup({ commit }, localId) {
		  commit('DELETE_UPLOAD_GROUP', localId);
		}
	},
	// getters:{
	//   getProgress: (state) => (localId, index) => {
	//     return state.uploads[localId]?.[index] || null;
	//   },
	//   getAllProgress: (state) => (localId) => {
	//     return state.uploads[localId] || null;
	//   },
	//   getAllUploadGroups: (state) => {
	//     return state.uploads;
	//   }
	// }
};